package org.spring.boot.example.dds;

import org.springframework.core.InfrastructureProxy;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

public class DynamicDataSource extends AbstractRoutingDataSource implements InfrastructureProxy {

	@Override
	protected Object determineCurrentLookupKey() {
		return DataSourceThreadLocal.getCurrentDataSourceName();
	}

	@Override
	public Object getWrappedObject() {
		return determineTargetDataSource();
	}

}
